package com.twu.biblioteca.fortests;

import java.io.OutputStream;
import java.io.PrintStream;

public class PrintObject extends PrintStream {
    String message;

    public PrintObject(OutputStream outputStream, boolean autoFlush) {
        super(outputStream, autoFlush);
        message = "";
    }

    @Override
    public void println(String message) {
        this.message = this.message + message + "\n";
    }

    @Override
    public void print(String message) {
        this.message = this.message + message;
    }

    @Override
    public void println(Object object) {
        println(object.toString());
    }

    @Override
    public void print(Object object) {
        print(object.toString());
    }

    public String getPrintedString() {
        return message;
    }
}
